// 商品详情页面的逻辑

// 获取元素
const imgBox = document.querySelector('.show > img')
const titleBox = document.querySelector('.title')
const priceBox = document.querySelector('.price')
const descBox = document.querySelector('.desc')

// 首先要拿到商品的id
const goodsId = window.sessionStorage.getItem('goodsId')
// 发送请去后去数据
setItem()
async function setItem() {
    let res = await pAjax({
        url: 'http://localhost:8888/goods/item',
        data: { id: goodsId },
        datatype: 'json'
    })
    console.log(res);

    imgBox.src = res.info.img_big_logo
    titleBox.innerText = res.info.title
    priceBox.innerText = `￥${res.info.price}`
    descBox.innerHTML = res.info.goods_introduce
}